From: Keir Fraser Date: Thu, 6 Aug 2009 08:15:42 +0000 (+0100) Subject: ept mtrr: replace unsigned long with mfn_t for mfns. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13513 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=70fc2398f035f16a1e6e6fc99af73e4d539a40c2;p=xen.git ept mtrr: replace unsigned long with mfn_t for mfns. Signed-off-by: Patrick Colp --- diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c index 58e9cef2ce..9cca4301a4 100644 --- a/xen/arch/x86/hvm/mtrr.c +++ b/xen/arch/x86/hvm/mtrr.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -712,7 +713,7 @@ HVM_REGISTER_SAVE_RESTORE(MTRR, hvm_save_mtrr_msr, hvm_load_mtrr_msr, uint8_t epte_get_entry_emt( struct domain *d, unsigned long gfn, - unsigned long mfn, uint8_t *igmt, int direct_mmio) + mfn_t mfn, uint8_t *igmt, int direct_mmio) { uint8_t gmtrr_mtype, hmtrr_mtype; uint32_t type; @@ -730,7 +731,7 @@ uint8_t epte_get_entry_emt( if ( (v == current) && v->domain->arch.hvm_domain.is_in_uc_mode ) return MTRR_TYPE_UNCACHABLE; - if ( !mfn_valid(mfn) ) + if ( !mfn_valid(mfn_x(mfn)) ) return MTRR_TYPE_UNCACHABLE; if ( hvm_get_mem_pinned_cacheattr(d, gfn, &type) ) @@ -752,6 +753,6 @@ uint8_t epte_get_entry_emt( } gmtrr_mtype = get_mtrr_type(&v->arch.hvm_vcpu.mtrr, (gfn << PAGE_SHIFT)); - hmtrr_mtype = get_mtrr_type(&mtrr_state, (mfn << PAGE_SHIFT)); + hmtrr_mtype = get_mtrr_type(&mtrr_state, (mfn_x(mfn) << PAGE_SHIFT)); return ((gmtrr_mtype <= hmtrr_mtype) ? gmtrr_mtype : hmtrr_mtype); } diff --git a/xen/arch/x86/mm/hap/p2m-ept.c b/xen/arch/x86/mm/hap/p2m-ept.c index 0388a8bb60..417a196b36 100644 --- a/xen/arch/x86/mm/hap/p2m-ept.c +++ b/xen/arch/x86/mm/hap/p2m-ept.c @@ -168,7 +168,7 @@ ept_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn, { if ( mfn_valid(mfn_x(mfn)) || (p2mt == p2m_mmio_direct) ) { - ept_entry->emt = epte_get_entry_emt(d, gfn, mfn_x(mfn), + ept_entry->emt = epte_get_entry_emt(d, gfn, mfn, &igmt, direct_mmio); ept_entry->igmt = igmt; ept_entry->sp_avail = walk_level ? 1 : 0; @@ -230,7 +230,7 @@ ept_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn, { split_ept_entry = split_table + i; split_ept_entry->emt = epte_get_entry_emt(d, - gfn-offset+i, split_mfn+i, + gfn-offset+i, _mfn(split_mfn+i), &igmt, direct_mmio); split_ept_entry->igmt = igmt; @@ -247,7 +247,7 @@ ept_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn, /* Set the destinated 4k page as normal */ split_ept_entry = split_table + offset; - split_ept_entry->emt = epte_get_entry_emt(d, gfn, mfn_x(mfn), + split_ept_entry->emt = epte_get_entry_emt(d, gfn, mfn, &igmt, direct_mmio); split_ept_entry->igmt = igmt; @@ -406,7 +406,7 @@ static int need_modify_ept_entry(struct domain *d, unsigned long gfn, uint8_t o_emt, p2m_type_t p2mt) { uint8_t igmt, emt; - emt = epte_get_entry_emt(d, gfn, mfn_x(mfn), &igmt, + emt = epte_get_entry_emt(d, gfn, mfn, &igmt, (p2mt == p2m_mmio_direct)); if ( (emt == o_emt) && (igmt == o_igmt) ) return 0; diff --git a/xen/include/asm-x86/mtrr.h b/xen/include/asm-x86/mtrr.h index 8793220a28..6ac29fa54c 100644 --- a/xen/include/asm-x86/mtrr.h +++ b/xen/include/asm-x86/mtrr.h @@ -2,6 +2,7 @@ #define __ASM_X86_MTRR_H__ #include +#include /* These are the region types. They match the architectural specification. */ #define MTRR_TYPE_UNCACHABLE 0 @@ -66,7 +67,7 @@ extern void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi); extern u32 get_pat_flags(struct vcpu *v, u32 gl1e_flags, paddr_t gpaddr, paddr_t spaddr, uint8_t gmtrr_mtype); extern uint8_t epte_get_entry_emt( - struct domain *d, unsigned long gfn, unsigned long mfn, + struct domain *d, unsigned long gfn, mfn_t mfn, uint8_t *igmt, int direct_mmio); extern void ept_change_entry_emt_with_range( struct domain *d, unsigned long start_gfn, unsigned long end_gfn);